local function AddWaveComponent(inst, args)
	local waves = inst.entity:AddWaveComponent()
    waves:SetRegionSize(unpack(args.RegionSize or {13.5, 2.5}))
    waves:SetWaveSize(unpack(args.WaveSize or {80, 3.5}))
	waves:SetWaveTexture(args.WaveTexture or "images/wave.tex")
	waves:SetWaveEffect(args.WaveEffect or "shaders/waves.ksh") -- texture.ksh

	return waves
end

local function CheckPrefab(inst)
	assert(inst.prefab ~= "rg_world", 
		"\"rg_world\" is a virtual prefab, you should override the prefab name.")
end



local function fn(Sim)
	local inst = SpawnPrefab("world")
	inst:AddTag("rg_world")

	inst.entity:SetCanSleep(false)

	inst.prefab = "rg_baseworld"

	inst:AddComponent("rg_maprevealer")
	inst:AddComponent("rg_worldtitle")

    inst:AddComponent("clock")
	inst:AddComponent("seasonmanager")

	
	-- inst.components.ambientsoundmixer:SetReverbPreset("cave")--?

	inst.RG_AddWaveComponent = AddWaveComponent

	inst:DoTaskInTime(0, CheckPrefab)
	
	-- component dummy methods
	for cmp,v in pairs{
		clock = {

		},
		seasonmanager = {
			StartWinter = 0,
			StartSpring = 0,
			StartSummer = 0,
			StartAutumn = 0,
		},
	}do
		for method, fn in pairs(v)do
			if fn == 0 then
				fn = function() return nil end
			elseif type(fn) == type(true) then 
				fn = function() return fn end
			else
				fn = fn 
			end
			inst.components[cmp]["RG_old_"..method] = inst.components[cmp][method]
			inst.components[cmp][method] = fn 
		end
	end

    return inst
end

local function b()
	inst.Map:SetOverlayTexture( "levels/textures/snow.tex" )

    return inst
end

return Prefab( "rg_baseworld", fn) 



